﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;

namespace MainService.ZYPT
{

    [XmlRoot("Components")]
    public class ZJS
    {
        [XmlElement("Component")]
        public List<ZJ> Childs = new List<ZJ>();
    }

    [XmlRoot("Component")]
    public class ZJ
    {
        [XmlAttribute("ID")]
        public string ID { get; set; }
        [XmlAttribute("CreateTime")]
        public string CreateTime { get; set; }
        [XmlAttribute("ChinaName")]
        public string ChinaName { get; set; }
        [XmlAttribute("Description")]
        public string Description { get; set; }
        [XmlAttribute("GroupName")]
        public string GroupName { get; set; }
        [XmlAttribute("TypeName")]
        public string TypeName { get; set; }
        [XmlIgnore]
        public string Reference { get; set; }
        [XmlIgnore]
        public string Link { get; set; }
        [XmlElement("Reference", typeof(CDATA))]
        public CDATA CDATAReference 
        {
            get 
            {
                return new CDATA(this.Reference);
            }
            set 
            {
                this.Reference = value.InnerXML;
            } 
        }

        [XmlElement("Link", typeof(CDATA))]
        public CDATA CDATALink
        { 
            get 
            {
                return new CDATA(this.Link);
            }
            set 
            {
                this.Link = value.InnerXML;
            } 
        }

        [XmlElement(DataType = "string", ElementName = "Image")]
        public string ImageUrl { get; set; }
        [XmlElement(DataType = "string", ElementName = "File")]
        public string FileUrl { get; set; }
        [XmlArray("Properties")]
        [XmlArrayItem("Property")]
        public List<ZJSX> Properties = new List<ZJSX>();
        [XmlArray("Events")]
        [XmlArrayItem("Event")]
        public List<ZJSJ> Events = new List<ZJSJ>();
        [XmlArray("Methodes")]
        [XmlArrayItem("Method")]
        public List<ZJFF> Methodes = new List<ZJFF>();
        [XmlIgnore]
        public Image Image { get; set; }
    }

    [XmlRoot("Property")]
    public class ZJSX 
    {
        [XmlAttribute("ChinaName")]
        public string ChinaName { get; set; }
        [XmlAttribute("Name")]
        public string Name { get; set; }
        [XmlAttribute("Type")]
        public string Type { get; set; }
        [XmlAttribute("DefaultValue")]
        public string DefaultValue { get; set; }
        [XmlAttribute("GroupName")]
        public string GroupName { get; set; }
        [XmlAttribute("Description")]
        public string Description { get; set; }
    }
  
    public class ZJSJ 
    {
        [XmlAttribute("Name")]
        public string Name { get; set; }
        [XmlAttribute("ChinaName")]
        public string ChinaName { get; set; }
        [XmlAttribute("Description")]
        public string Description { get; set; }
        [XmlElement("Parameter")]
        public List<ZJCS> Parameter = new List<ZJCS>();
    }
   
    public class ZJFF 
    {
        [XmlAttribute("Name")]
        public string Name { get; set; }
        [XmlAttribute("ChinaName")]
        public string ChinaName { get; set; }
        [XmlAttribute("Description")]
        public string Description { get; set; }
        [XmlElement("Parameter")]
        public List<ZJCS> Parameter = new List<ZJCS>();
    }

    public class ZJCS 
    {
        [XmlAttribute("Name")]
        public string Name { get; set; }
        [XmlAttribute("Description")]
        public string Description { get; set; }
    }
}
